//
//  NetworkTools.swift
//  SinaWeibo
//
//  Created by 胡阳 on 16/5/24.
//  Copyright © 2016年 young4ever. All rights reserved.
//

import UIKit
import AFNetworking

class NetworkTools: AFHTTPSessionManager {

    static let tool : NetworkTools = {
    
        // baseURL一定要以"/"结尾
        let url = NSURL(string: "https://api.weibo.com/")
        let t = NetworkTools(baseURL: url)
        
        // 设置AFN能够接收的数据类型
        t.responseSerializer.acceptableContentTypes = NSSet(objects:"application/json", "text/json", "text/javascript", "text/plain") as? Set<String>;
        return t
    }()
    
    // 获取单例的方法
    class func shareNetworkTools() -> NetworkTools {
    
        return tool
    }
}
